from appium import webdriver

if __name__ == "__main__":
    # 设备配置信息
    desired_caps = {
        'platformName': 'Android',
        'platformVersion': '12',
        'deviceName': '60.205.198.244:100',
        'appPackage': 'com.lianjia.beike',
        'appActivity': 'com.lianjia.activity.MainActivity',
    }

    print(desired_caps)

    # 连接到Appium Server todo 卡住了 链接不上对应
    driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
    print(driver)

    # 执行自动化操作
    element = driver.find_element_by_id('com.lianjia.beike:id/button')
    driver.find_elements()
    print(element)

    # 关闭连接
    driver.quit()